home *** CD-ROM | disk | FTP | other *** search
- From: clamage@Eng.Sun.COM (Steve Clamage)
- Message-ID: <4gi7h0$l0@engnews1.Eng.Sun.COM>
- X-Original-Date: 22 Feb 1996 17:01:20 GMT
- Path: in1.uu.net!bounce-back
- Date: 22 Feb 96 17:12:15 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: Problem with template overloading.
- Organization: Sun Microsystems Inc.
- References: <9602220718.AA11584@garlic.spices>
- Reply-To: clamage@Eng.Sun.COM
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMSykOuEDnX0m9pzZAQGhDQF/U7ANjJ24i7k24vwryxL3v+tTpG4Ho9aa
- cuesxUVNnG4kLTjDneC8F5Lr0WrUFeFK
- =Zfkj
-
- In article AA11584@garlic.spices, wikman@research.nokia.com (Johan Wikman)
- writes:
-
- >I'd like to be able to have a class and a template with the same name
- >in the same scope.
-
- class A { ... };
-
- template <class T>
- class A {
- void foo() { .... A ... }
- };
-
- In A<T>::foo, I use the identifier "A". Does that refer to the template
- or to the class? In order not to break all existing code, it must
- refer to the template. In that case, how do I refer to the class?
- Both things called "A" are in the same scope, and both can be used
- where the name of a type is wanted.
-
- Perhaps you can think of a special syntax that won't change the meaning
- of existing code, or we could say that you can't refer to class A anywhere
- in the scope of template A. The question is whether the extra complication
- is justified. Remember, you can use longer "official" type or
- template names, and add typedefs to make them easier to use.
- ---
- Steve Clamage, stephen.clamage@eng.sun.com
- ---
- [ To submit articles: try just posting with your news-reader.
- If that fails, use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu.
- ]
-